import java.time.LocalDateTime;

public abstract class User {
    protected String userId;
    protected String username;
    protected String password;
    protected LocalDateTime registerTime;
    protected String userType;
    protected String phone;
    protected boolean needChangePwd;

    public User(String userId, String username, String password, LocalDateTime registerTime, String userType, String phone) {
        if (password == null || password.length() < 8) {
            throw new IllegalArgumentException("密码长度不能少于8位");
        }
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.registerTime = registerTime;
        this.userType = userType;
        this.phone = phone;
        this.needChangePwd = false;
    }

    public String getUserId() { return userId; }
    public String getUsername() { return username; }
    public String getPassword() { return password; }
    public String getUserType() { return userType; }
    public String getPhone() { return phone; }
    public boolean isNeedChangePwd() { return needChangePwd; }
    public void setPassword(String password) { this.password = password; }
    public void setNeedChangePwd(boolean needChangePwd) { this.needChangePwd = needChangePwd; }
    public LocalDateTime getRegisterTime() { return registerTime; }
} 